package weibo4j.examples.timeline;

import java.util.regex.Pattern;

import reference.TokenMa;
import weibo4j.Timeline;
import weibo4j.Weibo;
import weibo4j.examples.oauth2.Log;
import weibo4j.model.Paging;
import weibo4j.model.Status;
import weibo4j.model.StatusWapper;
import weibo4j.model.WeiboException;

public class GetUserTimeline {

	public static void main(String[] args) {
		TokenMa aToken = new TokenMa();
		String access_token = aToken.getToken();
		Weibo weibo = new Weibo();
		weibo.setToken(access_token);
		Timeline tm = new Timeline();
		try {
			Paging page = new Paging(1, 200);
			Integer base = new Integer(0);
			Integer feature = new Integer(0);
			StatusWapper receive = tm.getUserTimelineByUid("3516663753", page, base, feature);

			Pattern p = Pattern.compile(".*博彩，和HG5.*");
			for(Status s : receive.getStatuses()){
				if(p.matcher(s.getText()).matches()){
					System.out.println("find one");
					System.out.println(s.getMid());
					System.out.println(s.getText());
				}
			}

		} catch (WeiboException e) {
			e.printStackTrace();
		}
	}

}
